// pages/maxpage/maxpage.js
Page({
  data: {
    num1: null,
    num2: null,
    result: ''
  },
  
  bindNum1Input: function(e) {
    this.setData({
      num1: parseFloat(e.detail.value)
    });
  },
  
  bindNum2Input: function(e) {
    this.setData({
      num2: parseFloat(e.detail.value)
    });
  },
  
  compareNumbers: function() {
    const { num1, num2 } = this.data;
    if (num1 === null || num2 === null) {
      this.setData({
        result: '请输入两个数字'
      });
      return;
    }
    
    if (num1 > num2) {
      this.setData({
        result: `第一个数字大，是 ${num1}`
      });
    } else if (num1 < num2) {
      this.setData({
        result: `第二个数字大，是 ${num2}`
      });
    } else {
      this.setData({
        result: `数字相等，是 ${num2}`
      });
    }
  }
});